"""empty message

Revision ID: 5eb7a516fa52
Revises: 303b9d86c2c9
Create Date: 2024-05-16 09:00:42.146365

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '5eb7a516fa52'
down_revision: Union[str, None] = '303b9d86c2c9'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('product',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=False),
    sa.Column('subject_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['subject_id'], ['subject.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('post', sa.Column('product_id', sa.Integer(), nullable=False))
    op.drop_constraint('post_subject_id_fkey', 'post', type_='foreignkey')
    op.create_foreign_key(None, 'post', 'product', ['product_id'], ['id'])
    op.drop_column('post', 'subject_id')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('post', sa.Column('subject_id', sa.INTEGER(), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'post', type_='foreignkey')
    op.create_foreign_key('post_subject_id_fkey', 'post', 'subject', ['subject_id'], ['id'])
    op.drop_column('post', 'product_id')
    op.drop_table('product')
    # ### end Alembic commands ###
